home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr29 / memsize.zip / ITEMS.H < prev    next >
C/C++ Source or Header  |  1995-01-04  |  8KB  |  358 lines

  1. /******************************************************************** ITEMS.H
  2.  *                                                                          *
  3.  *                     Display Item Class Definition                        *
  4.  *                                                                          *
  5.  ****************************************************************************/
  6.  
  7. #ifndef ITEMS_H
  8. #define ITEMS_H
  9.  
  10. class Item
  11. {
  12.   private:
  13.     USHORT Id ;                  // Item ID.
  14.     BOOL   Flag ;                // Flag: Show this item at this time?
  15.     BYTE   Name [80] ;           // Text for items profile name.
  16.     BYTE   Label [80] ;          // Text to display on left part of line.
  17.     BYTE   MenuOption [80] ;     // Text to display in system menu.
  18.  
  19.   protected:
  20.     ULONG  Value ;               // Current value.
  21.  
  22.   public:
  23.     Item ( USHORT id, PSZ pName, PSZ pLabel, PSZ pMenuOption )
  24.     {
  25.       Id = id ;
  26.       Flag = TRUE ;
  27.       strcpy ( PCHAR(Name), PCHAR(pName) ) ;
  28.       strcpy ( PCHAR(Label), PCHAR(pLabel) ) ;
  29.       strcpy ( PCHAR(MenuOption), PCHAR(pMenuOption) ) ;
  30.       Value = 0 ;
  31.     }
  32.  
  33.     USHORT QueryId     ( void ) { return ( Id   ) ; }
  34.     BOOL   QueryFlag   ( void ) { return ( Flag ) ; }
  35.     PBYTE  QueryName   ( void ) { return ( Name ) ; }
  36.     PBYTE  QueryLabel  ( void ) { return ( Label ) ; }
  37.     PBYTE  QueryOption ( void ) { return ( MenuOption ) ; }
  38.     ULONG  QueryValue  ( void ) { return ( Value ) ; }
  39.  
  40.     VOID SetFlag   ( void ) { Flag = TRUE ; }
  41.     VOID ResetFlag ( void ) { Flag = FALSE ; }
  42.  
  43.     VOID Paint
  44.     (
  45.       HPS hPS,
  46.       RECTL &Rectangle,
  47.       COLOR TextColor,
  48.       COLOR BackColor,
  49.       PSZ Text,
  50.       ULONG NewValue
  51.     ) ;
  52.  
  53.     virtual ULONG NewValue ( void )
  54.     {
  55.       return ( 0 ) ;
  56.     }
  57.  
  58.     virtual VOID Repaint
  59.     (
  60.       HPS hPS,
  61.       RECTL &Rectangle,
  62.       COLOR TextColor,
  63.       COLOR BackColor,
  64.       BOOL Mandatory
  65.     )
  66.     {
  67.       return ;
  68.     }
  69. } ;
  70.  
  71. class Clock : public Item
  72. {
  73.   private:
  74.     COUNTRYINFO CountryInfo ;
  75.     ResourceString *DaysOfWeek ;
  76.  
  77.   public:
  78.     Clock ( USHORT id, PSZ pName, PSZ pLabel, PSZ pMenuOption, COUNTRYINFO &countryinfo, class ResourceString *daysofweek )
  79.       : Item ( id, pName, pLabel, pMenuOption )
  80.     {
  81.       CountryInfo = countryinfo ;
  82.       DaysOfWeek = daysofweek ;
  83.     }
  84.  
  85.     ULONG NewValue ( void ) ;
  86.  
  87.     VOID Repaint
  88.     (
  89.       HPS hPS,
  90.       RECTL &Rectangle,
  91.       COLOR TextColor,
  92.       COLOR BackColor,
  93.       BOOL Mandatory
  94.     ) ;
  95. } ;
  96.  
  97. class ElapsedTime : public Item
  98. {
  99.   private:
  100.     COUNTRYINFO CountryInfo ;
  101.     ResourceString *Day ;
  102.     ResourceString *Days ;
  103.  
  104.   public:
  105.     ElapsedTime ( USHORT id, PSZ pName, PSZ pLabel, PSZ pMenuOption, COUNTRYINFO &countryinfo, class ResourceString *day, class ResourceString *days )
  106.       : Item ( id, pName, pLabel, pMenuOption )
  107.     {
  108.       CountryInfo = countryinfo ;
  109.       Day = day ;
  110.       Days = days ;
  111.     }
  112.  
  113.     ULONG NewValue ( void ) ;
  114.  
  115.     VOID Repaint
  116.     (
  117.       HPS hPS,
  118.       RECTL &Rectangle,
  119.       COLOR TextColor,
  120.       COLOR BackColor,
  121.       BOOL Mandatory
  122.     ) ;
  123. } ;
  124.  
  125. class SwapFree : public Item
  126. {
  127.   private:
  128.     COUNTRYINFO CountryInfo ;
  129.     PSZ SwapPath ;
  130.     ULONG MinFree ;
  131.  
  132.   public:
  133.     SwapFree ( USHORT id, PSZ pName, PSZ pLabel, PSZ pMenuOption, COUNTRYINFO &countryinfo, PSZ swappath, ULONG minfree )
  134.       : Item ( id, pName, pLabel, pMenuOption )
  135.     {
  136.       CountryInfo = countryinfo ;
  137.       SwapPath = new BYTE [ strlen(PCHAR(swappath)) + 1 ] ;
  138.       strcpy ( PCHAR(SwapPath), PCHAR(swappath) ) ;
  139.       MinFree = minfree ;
  140.     }
  141.  
  142.     ~SwapFree ( void )
  143.     {
  144.       delete [] SwapPath ;
  145.     }
  146.  
  147.     ULONG NewValue ( void ) ;
  148.  
  149.     VOID Repaint
  150.     (
  151.       HPS hPS,
  152.       RECTL &Rectangle,
  153.       COLOR TextColor,
  154.       COLOR BackColor,
  155.       BOOL Mandatory
  156.     ) ;
  157. } ;
  158.  
  159. class MemoryFree : public Item
  160. {
  161.   private:
  162.     COUNTRYINFO CountryInfo ;
  163.     class SwapFree *SwapFree ;
  164.  
  165.   public:
  166.     MemoryFree ( USHORT id, PSZ pName, PSZ pLabel, PSZ pMenuOption, COUNTRYINFO &countryinfo, class SwapFree *swapfree )
  167.       : Item ( id, pName, pLabel, pMenuOption )
  168.     {
  169.       CountryInfo = countryinfo ;
  170.       SwapFree = swapfree ;
  171.     }
  172.  
  173.     ULONG NewValue ( void ) ;
  174.  
  175.     VOID Repaint
  176.     (
  177.       HPS hPS,
  178.       RECTL &Rectangle,
  179.       COLOR TextColor,
  180.       COLOR BackColor,
  181.       BOOL Mandatory
  182.     ) ;
  183. } ;
  184.  
  185. class SwapSize : public Item
  186. {
  187.   private:
  188.     COUNTRYINFO CountryInfo ;
  189.     PSZ SwapPath ;
  190.  
  191.   public:
  192.     SwapSize ( USHORT id, PSZ pName, PSZ pLabel, PSZ pMenuOption, COUNTRYINFO countryinfo, PSZ swappath )
  193.       : Item ( id, pName, pLabel, pMenuOption )
  194.     {
  195.       CountryInfo = countryinfo ;
  196.       SwapPath = new BYTE [ strlen(PCHAR(swappath)) + 1 ] ;
  197.       strcpy ( PCHAR(SwapPath), PCHAR(swappath) ) ;
  198.     }
  199.  
  200.     ~SwapSize ( void )
  201.     {
  202.       delete [] SwapPath ;
  203.     }
  204.  
  205.     ULONG NewValue ( void ) ;
  206.  
  207.     VOID Repaint
  208.     (
  209.       HPS hPS,
  210.       RECTL &Rectangle,
  211.       COLOR TextColor,
  212.       COLOR BackColor,
  213.       BOOL Mandatory
  214.     ) ;
  215. } ;
  216.  
  217. class SpoolSize : public Item
  218. {
  219.   private:
  220.     COUNTRYINFO CountryInfo ;
  221.     PSZ SpoolPath ;
  222.  
  223.   public:
  224.     SpoolSize ( USHORT id, PSZ pName, PSZ pLabel, PSZ pMenuOption, COUNTRYINFO &countryinfo, PSZ spoolpath )
  225.       : Item ( id, pName, pLabel, pMenuOption )
  226.     {
  227.       CountryInfo = countryinfo ;
  228.       SpoolPath = new BYTE [ strlen(PCHAR(spoolpath)) + 1 ] ;
  229.       strcpy ( PCHAR(SpoolPath), PCHAR(spoolpath) ) ;
  230.     }
  231.  
  232.     ~SpoolSize ( void )
  233.     {
  234.       delete [] SpoolPath ;
  235.     }
  236.  
  237.     ULONG NewValue ( void ) ;
  238.  
  239.     VOID Repaint
  240.     (
  241.       HPS hPS,
  242.       RECTL &Rectangle,
  243.       COLOR TextColor,
  244.       COLOR BackColor,
  245.       BOOL Mandatory
  246.     ) ;
  247. } ;
  248.  
  249. class CpuLoad : public Item
  250. {
  251.   private:
  252.     PULONG IdleCount ;
  253.     ULONG MaxCount ;
  254.  
  255.   public:
  256.     CpuLoad ( USHORT id, PSZ pName, PSZ pLabel, PSZ pMenuOption, ULONG maxcount, PULONG idlecount )
  257.       : Item ( id, pName, pLabel, pMenuOption )
  258.     {
  259.       MaxCount = maxcount ;
  260.       IdleCount = idlecount ;
  261.     }
  262.  
  263.     ULONG NewValue ( void ) ;
  264.  
  265.     VOID Repaint
  266.     (
  267.       HPS hPS,
  268.       RECTL &Rectangle,
  269.       COLOR TextColor,
  270.       COLOR BackColor,
  271.       BOOL Mandatory
  272.     ) ;
  273. } ;
  274.  
  275. class TaskCount : public Item
  276. {
  277.   private:
  278.     HAB Anchor ;
  279.  
  280.   public:
  281.     TaskCount ( USHORT id, PSZ pName, PSZ pLabel, PSZ pMenuOption, HAB anchor )
  282.       : Item ( id, pName, pLabel, pMenuOption )
  283.     {
  284.       Anchor = anchor ;
  285.     }
  286.  
  287.     ULONG NewValue ( void ) ;
  288.  
  289.     VOID Repaint
  290.     (
  291.       HPS hPS,
  292.       RECTL &Rectangle,
  293.       COLOR TextColor,
  294.       COLOR BackColor,
  295.       BOOL Mandatory
  296.     ) ;
  297. } ;
  298.  
  299. class DriveFree : public Item
  300. {
  301.   private:
  302.     COUNTRYINFO CountryInfo ;
  303.     class ResourceString *DriveError ;
  304.     USHORT DriveNumber ;
  305.     BOOL Error ;
  306.  
  307.   public:
  308.     DriveFree ( USHORT id, PSZ pName, PSZ pLabel, PSZ pMenuOption, COUNTRYINFO &countryinfo, USHORT drivenumber, class ResourceString *driveerror )
  309.       : Item ( id, pName, pLabel, pMenuOption )
  310.     {
  311.       CountryInfo = countryinfo ;
  312.       DriveError = driveerror ;
  313.       DriveNumber = drivenumber ;
  314.       Error = FALSE ;
  315.     }
  316.  
  317.     ULONG NewValue ( void ) ;
  318.  
  319.     VOID Repaint
  320.     (
  321.       HPS hPS,
  322.       RECTL &Rectangle,
  323.       COLOR TextColor,
  324.       COLOR BackColor,
  325.       BOOL Mandatory
  326.     ) ;
  327. } ;
  328.  
  329. class TotalFree : public Item
  330. {
  331.   private:
  332.     COUNTRYINFO CountryInfo ;
  333.     ULONG Drives ;
  334.  
  335.   public:
  336.     TotalFree ( USHORT id, PSZ pName, PSZ pLabel, PSZ pMenuOption, COUNTRYINFO &countryinfo, ULONG drives )
  337.       : Item ( id, pName, pLabel, pMenuOption )
  338.     {
  339.       CountryInfo = countryinfo ;
  340.       Drives = drives ;
  341.     }
  342.  
  343.     VOID ResetMask ( ULONG drives ) { Drives = drives ; }
  344.  
  345.     ULONG NewValue ( void ) ;
  346.  
  347.     VOID Repaint
  348.     (
  349.       HPS hPS,
  350.       RECTL &Rectangle,
  351.       COLOR TextColor,
  352.       COLOR BackColor,
  353.       BOOL Mandatory
  354.     ) ;
  355. } ;
  356.  
  357. #endif
  358.